<script>
  //   import listFn from "./config"
  //   import * as k8s from "@kubernetes/client-node"
  import k8s from "@kubernetes/client-node"
  import { onMount } from "svelte"
  let listFn
  function init() {
    const kc = new k8s.KubeConfig()
    kc.loadFromDefault()

    const k8sApi = kc.makeApiClient(k8s.CoreV1Api)

    listFn = async () => await k8sApi.listNamespacedPod("kube-system")
    console.log(listFn)
  }
  onMount(() => {
    init()
  })
</script>

{#await listFn}
  <p>...waiting</p>
{:then value}
  <p>The number is {value}</p>
{:catch error}
  <p style="color: red">{error.message}</p>
{/await}
